home *** CD-ROM | disk | FTP | other *** search
- package sun.misc;
-
- import java.util.Enumeration;
- import java.util.NoSuchElementException;
-
- public class CompoundEnumeration<E> implements Enumeration<E> {
- private Enumeration[] enums;
- private int index = 0;
-
- public CompoundEnumeration(Enumeration[] var1) {
- this.enums = var1;
- }
-
- private boolean next() {
- while(this.index < this.enums.length) {
- if (this.enums[this.index] != null && this.enums[this.index].hasMoreElements()) {
- return true;
- }
-
- ++this.index;
- }
-
- return false;
- }
-
- public boolean hasMoreElements() {
- return this.next();
- }
-
- public E nextElement() {
- if (!this.next()) {
- throw new NoSuchElementException();
- } else {
- return (E)this.enums[this.index].nextElement();
- }
- }
- }
-